#!/bin/bash

# Test rejoin cluster

. ./common

for i in 0 1 2; do
    _start_sheep $i
done

_wait_for_sheep 3

$DOG cluster format
sleep 1

# kill a non-master sheep
_kill_zk_session 1

# wait for rejoin
sleep 5

# kill a master
_kill_zk_session 0

# wait for rejoin
sleep 5

for i in 0 1 2; do
    $DOG cluster info -p 700$i | _filter_cluster_info
done

$DOG vdi create test 10M
for i in 0 1 2; do
    _vdi_list -p $((7000+$i))
done
